import validateRule from '@/utils/validateRule'
import { SALE_ORDER_TYPE } from '@/model/type'
export const columns = (ctx) => {
  // 已通过
  return [
    {
      prop: 'orderNo',
      label: '销售单号',
      headCheck: '1',
      minWidth: 200,
      toolTip: true
    },
    {
      label: '销售单类型',
      headCheck: '1',
      minWidth: 120,
      render: (h, row) => {
        return [
          <el-tag size="medium" type={SALE_ORDER_TYPE[row.saleTypeName] || 'primary'}>
            {row.saleTypeName || '-'}
          </el-tag>
        ]
      }
    },
    {
      prop: 'productTypeName',
      label: '产品类型',
      headCheck: '1',
      minWidth: 120
    },
    {
      prop: 'name',
      label: '销售单名称',
      headCheck: '1',
      minWidth: 200,
      toolTip: true
    },
    {
      prop: 'customerName',
      label: '关联客户',
      headCheck: '1',
      minWidth: 200,
      toolTip: true
    },
    {
      prop: 'status',
      label: '订单状态',
      headCheck: '1',
      minWidth: 150,
      render: (h, row) => {
        let typeList = {
          1: 'success',
          2: 'danger',
          3: 'warning',
          4: 'info',
          5: 'success'
        }
        return [
          <el-tag size="medium" type={typeList[+row.status]}>
            {row.statusName}
          </el-tag>
        ]
      }
    },
    {
      prop: 'signDate',
      label: '签单日期',
      headCheck: '1',
      minWidth: 160
    },
    {
      prop: 'saleTotalPrice',
      label: '销售单总金额',
      headCheck: '1',
      minWidth: 120
    },
    {
      prop: 'refundTotalPrice',
      label: '退款总额',
      headCheck: '1',
      minWidth: 100
    },
    {
      prop: 'actualSaleTotalPrice',
      label: '实际销售总金额',
      headCheck: '1',
      minWidth: 140
    },
    {
      prop: 'payMoney',
      label: '已回款金额',
      headCheck: '1',
      minWidth: 120
    },

    {
      prop: 'invoicePrice',
      label: '已开票金额',
      headCheck: '1',
      minWidth: 120
    },
    {
      prop: 'payStatus',
      label: '回款状态',
      headCheck: '1',
      minWidth: 100,
      render: (h, row) => {
        let typeList = {
          1: 'info',
          2: 'warning',
          3: 'success',
          4: 'danger'
        }
        return [<el-tag type={typeList[+row.payStatus]}>{row.payStatusName}</el-tag>]
      }
    },
    {
      label: '操作',
      headFixed: '1',
      fixed: 'right',
      minWidth: 100,
      render: (h, row, index) => {
        return [
          <el-button type="text" onClick={() => ctx.onDetail(row)}>
            详情
          </el-button>
        ]
      }
    }
  ]
}
